#include <json/json.h>

#include "DataSvrProtoHelper.h"


string build_get_file_control_info_response(const vector<uint32_t> crcs, int64_t file_size) {
	json_object * j = json_object_new_object();
	json_object * j_crc = json_object_new_array();
	json_object * j_file_size = json_object_new_int(file_size);
	for (vector<uint32_t>::const_iterator iter = crcs.begin(); crcs.end() != iter; iter++) {
		json_object * j_t = json_object_new_int(*iter);
		json_object_array_add(j_crc, j_t);
	};
	json_object_object_add(j, "CRC", j_crc);
	json_object_object_add(j, "FILE_SIZE", j_file_size);
	json_object * j_result = json_object_new_int(0);
        json_object_object_add(j, "RESULT", j_result);
        string response = json_object_to_json_string(j);
        json_object_put(j);
        return response;
}
